// JavaScript Document
function viewBranch()
{
	with (window.document.frmListProduct) {
		if (cboCategory.selectedIndex == 0) {
			window.location.href = 'index.php';
		} else {
			window.location.href = 'index.php?br_id=' + cboCategory.options[cboCategory.selectedIndex].value;
		}
	}
}

function checkAddBranchForm()
{

	with (window.document.frmAddBranch) {
		if (isEmpty(txtName, 'Enter Branch name')) {
			txtName.focus();
			return;
		} else if (isEmpty(txtLocation, 'Enter Branch location')) {
			txtLocation.focus();
			return;
		} else {
			submit();
		}
	}
}

function addBranch()
{
	window.location.href = 'index.php?view=add';
}

function modifyBranch(branchId)
{
	window.location.href = 'index.php?view=modify&branchId=' + branchId;
}

function deleteBranch(branchId)
{
	if (confirm('Delete this branch?')) {
		window.location.href = 'processBranch.php?action=deleteBranch&branchId=' + branchId ;
	}
}

function deleteImage(productId)
{
	if (confirm('Delete this image')) {
		window.location.href = 'processProduct.php?action=deleteImage&productId=' + productId;
	}
}